package cn.sm1234.controller;

import org.springframework.scheduling.support.SimpleTriggerContext;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

@RestController
public class UploadController {
    private Map<String, Object> result = new HashMap<String, Object>();
    @RequestMapping("/uploadAttach")
    public Map<String, Object> upload(@RequestParam("attach")MultipartFile file) throws Exception{
        System.out.println("uploading: "+ file.getOriginalFilename());

        file.transferTo(new File("e:/" + file.getOriginalFilename()));
        result.put("success", true);
        return  result;
    }
}
